<?php
class App_Module_Admin_Component_Media_Tpl_Editform extends App_Module_Admin_Tpl_Block_Editform
{
	protected $_form = 'entity/media';

	public function GetForm($ctrlName, $file)
	{
        $this->ctrlName = $ctrlName;
        $this->file = $file;

        //Mozg_Registry::Set('mediaObject', $file);

		return $this->CreateForm($file);
	}

	protected function GetActionUrl()
	{
		return array('module' => 'admin', 'ctrl' => $this->ctrlName, 'action' => 'save', 'id' => $this->file->GetId() );
	}

	protected function GetBackUrl()
	{
		return array('module' => 'admin', 'ctrl' => $this->ctrlName);
	}

	protected function GetHeaderTitle()
	{
		if ($this->file->GetId())
		{
		    $title = Mozg_Lang::_('EDIT_MEDIA_FILE');
		}
		else
		{
		    $title = Mozg_Lang::_('ADD_MEDIA_FILE');
		}

		return $title;
	}

	protected function GetHeaderIcons()
	{
        $icons[] = array(
        	'add' => array(
        					'title' => 'ADD',
        					'url' => Mozg_Router::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'media', 'action' => 'add'))
        					),
        );

        if ($this->file->GetId())
        {
	        $icons[] = array(
	        	'delete' => array(
	        					'title' => 'DELETE_MEDIA_FILE?',
	        					'url' => Mozg_Router::Get('http')->Create(array('module' => 'admin', 'ctrl' => 'media', 'action' => 'del', 'id' => $this->file->GetId()))
	        					),
	        );
        }

        return $icons;
	}
}